<template>
  <div>
    <!-- 工具栏 -->
    <tl-list-toolbar ref="toolbar" :isDisplayAdd="editable" :isDisplayDeleteBatch="editable" @add="openAddDialog('editForm')" @exportExcel="doExportExcel" @deleteBatch="doDeleteBatch" @refresh="doRefresh" @columnCustomize="doColumnCustomize" @displaySearch="doDisplaySearch" :disableDeleteBatch="selectedRowKeys.length <= 0">
      <template slot="left-btn"> </template>
    </tl-list-toolbar>
    <div>
      <!-- 列表选择 -->
      <div class="table-alert-div" ref="selector">
        <el-alert type="success" :closable="false" class="tl-table-alert-info" effect="light">
          <template slot="title">
            已选择&nbsp;<a class="tl-table-alert-info-a1">{{ selectedRowKeys.length }}</a
            >项&nbsp;&nbsp;
            <a class="tl-table-alert-info-a2" @click="doClearSelected">全部清空</a>
          </template>
        </el-alert>
      </div>
      <!--表格渲染-->
      <el-table class="tl-table" ref="mainTable" :height="300" v-loading="loading" :data="datas" @selection-change="doSelectChange" @sort-change="doSortChange" @row-dblclick="doRowDbClick" @row-click="doRowClick" row-key="id" border fit :row-class-name="doChangeRowClassName">
        <el-table-column type="selection" width="55px" fixed="left" :selectable="doDisableCheckBox"></el-table-column>
        <el-table-column type="index" label="序号" width="55px" align="center"></el-table-column>
				<el-table-column prop="projectid" label="立项id" width="150px" sortable="custom" sort-by="projectid" align="center" header-align="center" :show-overflow-tooltip="true"></el-table-column>
				<el-table-column prop="appointmentid" label="任命书id" width="150px" sortable="custom" sort-by="appointmentid" align="center" header-align="center" :show-overflow-tooltip="true"></el-table-column>
				<el-table-column prop="projectcode" label="项目编号" width="150px" sortable="custom" sort-by="projectcode" align="center" header-align="center" :show-overflow-tooltip="true"></el-table-column>
				<el-table-column prop="teamname" label="项目团队名称" width="150px" sortable="custom" sort-by="teamname" align="center" header-align="center" :show-overflow-tooltip="true"></el-table-column>
				<el-table-column prop="projectadvantage" label="项目亮点" width="150px" sortable="custom" sort-by="projectadvantage" align="center" header-align="center" :show-overflow-tooltip="true"></el-table-column>
				<el-table-column prop="advantagereason" label="亮点原因分析" width="150px" sortable="custom" sort-by="advantagereason" align="center" header-align="center" :show-overflow-tooltip="true"></el-table-column>
				<el-table-column prop="advantageadvice" label="亮点建议" width="150px" sortable="custom" sort-by="advantageadvice" align="center" header-align="center" :show-overflow-tooltip="true"></el-table-column>
				<el-table-column prop="projectdisadvantage" label="项目不足" width="150px" sortable="custom" sort-by="projectdisadvantage" align="center" header-align="center" :show-overflow-tooltip="true"></el-table-column>
				<el-table-column prop="disadvantagereason" label="不足原因分析" width="150px" sortable="custom" sort-by="disadvantagereason" align="center" header-align="center" :show-overflow-tooltip="true"></el-table-column>
				<el-table-column prop="disadvantageadvice" label="不足建议" width="150px" sortable="custom" sort-by="disadvantageadvice" align="center" header-align="center" :show-overflow-tooltip="true"></el-table-column>
				<el-table-column prop="description" label="备注" min-width="250px" align="left" header-align="center" :show-overflow-tooltip="true"></el-table-column>
				<el-table-column prop="enabled" label="有效" width="100px" sortable="custom" sort-by="enabled" align="center" header-align="center">
					<template slot-scope="scope">
						<el-tag v-if="scope.row.enabled === 1" type="success">是</el-tag>
						<el-tag v-else type="danger">否</el-tag>
					</template>
				</el-table-column>
        <el-table-column label="操作" width="220px" v-slot="scope" fixed="right">
          <el-button type="text" icon="el-icon-edit" @click="openEditDialog('editForm', scope.row.id)" v-if="editable">编辑</el-button>
          <el-button type="text" icon="el-icon-edit" @click="openViewDialog('editForm', scope.row.id)" v-else>查看</el-button>
          <el-button type="text" icon="el-icon-delete" @click="doDelete(scope.row.id)" :disabled="!editable">删除</el-button>
          <el-dropdown trigger="hover">
            <el-button type="text" icon="el-icon-s-operation" style="margin-left:10px">更多<i class="el-icon-arrow-down el-icon--right"></i></el-button>
            <el-dropdown-menu>
              <el-dropdown-item icon="el-icon-view" @click.native="openViewDialog('editForm', scope.row.id)" v-if="editable">查看</el-dropdown-item>
              <el-dropdown-item icon="el-icon-view" @click.native="openEditDialog('editForm', scope.row.id)" :disabled="true" v-else>编辑</el-dropdown-item>
            </el-dropdown-menu>
          </el-dropdown>
        </el-table-column>
      </el-table>
      <!-- 列表分页 -->
      <el-row class="pagebar" ref="pager">
        <el-pagination @size-change="doChangeSize" @current-change="doChangeIndex" :current-page="pageInfo.currentPage" :page-sizes="pageInfo.pageSizes" :total="pageInfo.totalCount" layout="total, sizes, prev, pager, next, jumper" background class="tl-table-pagination"> </el-pagination>
      </el-row>
      <tl-edit ref="editForm" @refresh="doRefresh" :parentId="parentId"></tl-edit>
    </div>
  </div>
</template>

<script>
/** mixins */
import { mixin_list } from '@tapui/mixins/mixin_list'
/** 子组件 */
import tlEdit from './edit'
/** 工具类 */
import { getAction, putAction, postAction, deleteAction } from '@tapui/utils/http'
export default {
  name: 'sdProjectTeamType',
  mixins: [mixin_list],
  components: { tlEdit },
  data() {
    return {
      description: 'SD项目任命-项目组分类-列表查询',
      urlPrefix: '/sd/projectTeamType/',
      url: {
        // queryCodeList: '/sd/projectTeamType/dataCodeList'
      },
      // 排序参数
      sorterInfo: {
        sidx: 'sortcode',
        sord: 'asc'
      },
      isQueryOnCreated: false
    }
  },
  props: {
    parentId: {
      type: [Number, String],
      default: ''
    },
    editable: {
      type: Boolean,
      default: true
    }
  },
  methods: {
    initPage() {
      if (this.editable) {
        this.rowDbClickActionType = 'edit'
      } else {
        this.rowDbClickActionType = 'view'
      }
    },
    beforeLoadData() {
      if (!this.parentId) {
        return false
      }
      this.queryParam.parentid = this.parentId
      return true
    }
  }
}
</script>

<style scoped></style>

